package examples;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

/**
 * @author Jay
 */
public class Scheduled {
    static Logger logger = Logger.getLogger("Scheduler");

    public static void main(String[] args) {
        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
        scheduledThreadPoolExecutor.scheduleAtFixedRate(()->{
        logger.info("定时任务");
        }, 1, 1, TimeUnit.SECONDS);
    }
}
